<template>
  <div>
    <el-table stripe max-height="40vh" :data="list">
        <el-table-column width="100" label="序号" type="index" :index="index+1"></el-table-column>
        <el-table-column label="文件" prop="fileName"></el-table-column>
        <el-table-column width="100" label="操作">
            <template #default="{row}">
                <el-button  text type="primary" @click="toDownload(row)">下载</el-button>
            </template>
        </el-table-column>
    </el-table>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive, toRefs, onMounted} from 'vue'
import apiMod from '@/apiMod/index'
import FileSaver from 'file-saver'
type Props = {
	nowRowData?: any
}
let props = withDefaults(defineProps<Props>(), {
	nowRowData: {},
})
let index = ref(0)
let list = ref([])
// 获取列表
const getFileList = () =>{
  let params = {
    applyId:props.nowRowData.applyId
  }
  apiMod.view_nqtApplyFile_page(params).then(res=>{
    if(res.code==0){
      list.value = res.data.records
    }
  })
}
getFileList()
// 下载
const toDownload = (row) =>{
  apiMod.view_nqtApplyFile_download(row.id).then(res=>{
    FileSaver.saveAs(res,row.fileName)
  })
} 
</script>
<style scoped lang="scss">
</style>